<?php
set_include_path ( $_SERVER ['DOCUMENT_ROOT'] );
include_once 'admin/includes/functions/admin-functions.php';
global $DBobject, $CONFIG, $SMARTY;

if($_SERVER['REMOTE_ADDR'] != '150.101.230.130') die('Restricted area');

$order_cartId = '0';
$paymentId = '0';
$studentId = '0';

$enrolments = array();
$enrol_obj = new Enrolment();
$orderData = $enrol_obj->GetDataCart($order_cartId);
$orderItems = $enrol_obj->GetDataProductsOnCart($order_cartId);
if(!empty($orderData) && !empty($orderItems) && !empty($paymentId) && !empty($studentId)){
	foreach ($orderItems as $item){
		foreach ($item['attributes'] as $attr){
			if($attr['cartitem_attr_attribute_name'] == 'week'){
				$enrolments[]=$enrol_obj->AddEnrolmentByClasstermId($studentId, $item['cartitem_product_id'], $attr['cartitem_attr_attr_value_name'], $item['cartitem_enrolment_type'], 1,  $paymentId);
			}
		}
	} 
}

var_dump($enrolments);
die();